import { FormRules } from "element-plus"

export const formRules: FormRules = {
  workName: [{ type: "string" }],
  studyingExperience: [
    {
      trigger: "change",
      validator: (rule, val, cb) => {
        if ([undefined, 0, 1, 2, 3, 4, 5, 6].includes(val)) {
          cb()
        } else {
          cb("请选择正确的学历选项")
        }
      }
    }
  ],
  workTime: [
    {
      trigger: "change",
      validator: (rule, val, cb) => {
        if ([undefined, 0, 1, 2, 3, 4, 5].includes(val)) {
          cb()
        } else {
          cb("请选择正确的工作经验范围")
        }
      }
    }
  ],
  workAddress: [
    {
      type: "array",
      trigger: "change",
      validator: (rule, val, cb) => {
        if (val === undefined || (Array.isArray(val) && [0, 1, 2, 3].includes(val.length))) {
          cb()
        } else {
          cb("您选择的工作区域地址不正确")
        }
      }
    }
  ],
  workMinPrice: [
    {
      type: "number",
      trigger: "blur",
      message: "你输入的期望最少工资不正确"
    }
  ],
  workMaxPrice: [
    {
      type: "number",
      trigger: "blur",
      message: "你输入的期望最多工资不正确"
    }
  ]
}
